package com.tz.service.impl;

import com.tz.entity.Clazz;
import com.tz.entity.ClazzType;
import com.tz.mapper.ClazzMapper;
import com.tz.service.ClazzService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by oo on 2018/1/3.
 */
@Transactional
@Service
public class ClazzServiceImpl implements ClazzService {

    @Autowired
    ClazzMapper clazzMapper;

    @Override
    public List<Clazz> getAllCalzz(ClazzType clazzType) {
        return clazzMapper.selectClazzByClazzType(clazzType);
    }

    @Override
    public List<ClazzType> getClazzType() {
        return clazzMapper.selectAllClazzType();
    }

    @Override
    public Clazz getClazz(Long id) {
        return clazzMapper.selectClazzById(id);
    }

    @Override
    public void changeClazz(Clazz clazz) {
        clazzMapper.updataClazz(clazz);
    }

    @Override
    public void addClazz(Clazz clazz) {
        clazz.setIsfinish(0);
        clazzMapper.insterClazz(clazz);
    }
}
